From 7082624fd72dd42bbb1b8908195ed8b29a7baac5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 16 Sep 2020 22:58:58 -0400 Subject: [PATCH] textview: Properly delete anchored children When we remove anchors with widgets from the text buffer, we used to call gtk_widget_destroy(), which indirectly called gtk_container_remove() which cleared the child properly. When gtk_widget_destroy() was removed, we replaced the calls with gtk_widget_unparent(), but that is not enough. Explicitly call gtk_text_view_remove() instead - we know the parent is a text view. --- gtk/gtktextchild.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c index f569a503bd..4d5e30e44f 100644 --- a/gtk/gtktextchild.c +++ b/gtk/gtktextchild.c @@ -236,8 +236,8 @@ child_segment_delete_func (GtkTextLineSegment *seg, { GtkWidget *child = tmp_list->data; - gtk_widget_unparent (child); - + gtk_text_view_remove (GTK_TEXT_VIEW (gtk_widget_get_parent (child)), child); + tmp_list = tmp_list->next; } -- 2.30.2